local xiaolian = fk.CreateSkill{
    name = "SP_heg__xiaolian",
}

Fk:loadTranslationTable{
    ["SP_heg__xiaolian"] = "孝廉",
    [":SP_heg__xiaolian"] = "当与你势力相同的角色受到致命伤害时，你可以移除此武将牌令其回复1点体力并获得〖飞影〗。",

    ["#SP_heg__xiaolian-invoke"] = "孝廉：你可以移除此武将牌，令 %dest 回复1点体力并获得〖飞影〗",
    ["@@xiaolian_feiying"] = "孝廉 飞影",

    ["$SP_heg__xiaolian1"] = "尔等叛贼，来一个我杀一个。",
    ["$SP_heg__xiaolian2"] = "父亲上马，孩儿随后便来。",
}

local H = require "packages.ol_hegemony.util"

xiaolian:addEffect(fk.DetermineDamageInflicted,{
    anim_type = "big",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(xiaolian.name) and H.compareKingdomWith(target, player) and data.damage >= target.hp
    end,
    on_cost = function(self, event, target, player, data)
        return player.room:askToSkillInvoke(player, { skill_name = xiaolian.name, prompt = "#SP_heg__xiaolian-invoke::" .. target.id })
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local isDeputy = H.inGeneralSkills(player, xiaolian.name)
        if isDeputy then
            H.removeGeneral(player, isDeputy == "d")
        end
        if target:isWounded() then
        room:recover({
            who = target,
            num = 1,
            recoverBy = player,
            skillName = xiaolian.name
        })
       end
       if not target.dead then
       room:handleAddLoseSkills(target,"SP_heg__feiying", nil, true, true)
       room:setPlayerMark(target, "@@xiaolian_feiying", 1)
       end
    end,
})

return xiaolian